C:\Users\Enzymes Technology\Desktop\SQLQuery4.sql
AND Email IS NOT NULL;
22
3. High consultancy fee
Find all patients whose consultancy fee is between 1,000 and 5,000, whose appointment type is not Emergency, and whose payment
status is Paid.
SELECT *
FROM tblMainMaster_Advent_health
WHERE Consultancy_Fee BETWEEN 1000 AND 5000
AND Appointment_Type <> 'Emergency'
AND Payment_Status = 'Paid';
4. Finalized severe reports
Find all reports where the report is Finalized, the severity score is greater than 50, and pathology was detected.
SELECT *
FROM tblReports_tests
WHERE Report_Status = 'Finalized'
AND Severity_Score > 50
AND Pathology_Detected = 'Yes';
5. High-value billing records
Find all billing records where the total amount is greater than 20,000, the pending amount is greater than 5,000, and the billing
status is not Closed.
SELECT *
FROM tblBilling_Summary
WHERE Total_Amount > 20000
AND Pending_Amount > 5000
AND Billing_Status <> 'Closed';
6. Seattle or Las Vegas patients
Find all female patients from Seattle or Las Vegas whose blood group is A+ or B+.
SELECT *
FROM tblPatient_Infomation
WHERE Gender = 'FEMALE'
AND City IN ('Seattle', 'Las Vegas')
AND Blood_Group IN ('A+', 'B+');
7. Chest or heart patients
Find all patients whose chief complaint is either Chest Pain or Heart Pain, where the risk factor is Smoking or Diabetes, and the
consultancy fee is greater than 1,000.
SELECT
Patient_ID,
Chief_Complaint,
Risk_Factors,
Consultancy_Fee
FROM tblMainMaster_Advent_health
WHERE Chief_Complaint IN ('Chest Pain', 'Heart Pain')
AND Risk_Factors IN ('Smoking', 'Diabetes')
AND Consultancy_Fee > 1000;
8. Completed or scheduled procedures
Find all procedures where the procedure status is Completed or Scheduled, the priority is High or Critical, and the procedure
charge is greater than 5,000.
SELECT *
FROM tblProcedure_Scans
WHERE Procedure_Status IN ('Completed', 'Scheduled')
AND Priority IN ('High', 'Critical')
AND Procedure_Charges > 5000;
9. Multiple medical conditions
Find all patients whose medical history contains Diabetes or Hypertension, whose risk factor is Smoking or Obesity, and whose
consultancy fee is between 2,000 and 8,000.
SELECT
Patient_ID,
Medical_History,
Risk_Factors,
Consultancy_Fee
FROM tblMainMaster_Advent_health
WHERE Medical_History IN ('Diabetes', 'Hypertension')
AND Risk_Factors IN ('Smoking', 'Obesity')
AND Consultancy_Fee BETWEEN 2000 AND 8000;
10. Complex AND + OR using parentheses
Find all patients where either the patient is Male and has blood group A+ or B+, or the patient is Female and has blood group O+
or AB+, and the patient has an available email address.
SELECT *
FROM tblPatient_Infomation
WHERE
(
Gender = 'MALE'
AND Blood_Group IN ('A+', 'B+')